<?php
declare(strict_types=1);
/**
 * 单例服务基类
 */
namespace Service;
class BaseService
{
    /**
     * instance
     * @var 
     */
    private static $instance;

     /**
    * @get instance
    * @return static
    */
    public static function instance()
    {
        $class_name = get_called_class();
    
        if (empty(self::$instance[$class_name])) {
            self::$instance[$class_name] = new static();
        }
        return self::$instance[$class_name];
    }
}